Skip to content

feat(pgls_query): add PLpgSQL protobuf parsing support#639

Draft
psteinroe wants to merge 1 commit intomainfrom
feat/plpgsql-parser
Draft

feat(pgls_query): add PLpgSQL protobuf parsing support#639
psteinroe wants to merge 1 commit intomainfrom
feat/plpgsql-parser

Conversation

@psteinroe
Copy link
Copy Markdown
Collaborator

Summary

  • Replace JSON-based parse_plpgsql with protobuf-based implementation
  • Add PlpgsqlParseResult struct with typed access to parsed PL/pgSQL functions
  • Export PLpgSQL protobuf types (PLpgSqlFunction, PLpgSqlStmt, etc.)
  • Add comprehensive tests verifying parsed structure (IF, WHILE, assignments)

Upstream Dependency

This PR requires upstream changes to libpg_query that have not been merged yet.

The changes add pg_query_parse_plpgsql_protobuf() API to libpg_query. Currently pointing to fork:

Once upstream accepts the changes, the submodule should be updated to point back to pganalyze/libpg_query.

Test plan

  • All 32 existing tests pass
  • New tests verify parsed PLpgSQL structure (IF conditions, WHILE loops, assignments)
  • Doc tests pass

@psteinroe psteinroe force-pushed the feat/plpgsql-parser branch 2 times, most recently from 0a9caa2 to ea26c15 Compare January 21, 2026 21:19
- Update libpg_query submodule to fork with PLpgSQL protobuf API
- Replace JSON-based parse_plpgsql with protobuf-based implementation
- Add PlpgsqlParseResult struct with typed access to parsed functions
- Export PLpgSQL protobuf types (PLpgSqlFunction, PLpgSqlStmt, etc.)
- Update bindgen allowlist for new FFI functions
- Filter PLpgSQL and SummaryResult types from Node iteration macros
- Add comprehensive tests verifying parsed structure (IF, WHILE, assignments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant